<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-show指令</title>
</head>

<body>
    <div id="app">
        <h2>直接使用v-show</h2>
        <img src="img/OIP.jpg" alt="" v-show="true">
        <h2>绑定事件</h2>
        <input type="button" value="切换显示状态" @click="changeIsShow"></input>
        <img src="img/OIP.jpg" alt="" v-show="isShow">
        <h2>绑定条件</h2>
        <input type="button" value="累加年龄" @click="ageAdd"></input>
        <img src="img/OIP.jpg" alt="" v-show="age>=18">
    </div>

    <!-- 开发环境版本 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                isShow: false,
                age: 16
            },
            methods: {
                changeIsShow: function () {
                    this.isShow = !this.isShow;
                },
                ageAdd: function () {
                    this.age++;
                }
            }
        })
    </script>
</body>

</html>